package com.hxf.dto;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 公共实体类
 * @author tengyicheng
 * @version [1.0, 2013/09/22]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
public class BaseDto implements Serializable { 
	private static final long serialVersionUID = 1L;
	
	//分页
	private int currentPage = 1;
	private int pageSize = 10;
	private int pageCount;
	private int elementCount;
	private String createUser;
	private String createTime; 
	private String updateTime;
	private String updateUser;

	/**
	 * 无效
	 */
	public static final short STATUS_0 = 0;
	
	/**
	 * 有效
	 */
	public static final short STATUS_1 = 1;

	/**
	 * 获取当前页数 索引从1开始
	 * 
	 * @return
	 */
	public int getCurrentPage() {
		return currentPage;
	}

	/**
	 * 设置当前页数
	 * 
	 * @param currentPage
	 */
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage <= 0 ? 1 : currentPage;
	}

	/**
	 * 获取页面显示条数
	 * 
	 * @return
	 */
	public int getPageSize() {
		return pageSize;
	}

	/**
	 * 设置页面显示条数
	 * 
	 * @param pageSize
	 */
	public void setPageSize(int pageSize) {
		if (pageSize > 0) {
			this.pageSize = pageSize;
		}
	}

	/**
	 * 获取总页数
	 * 
	 * @return
	 */
	public int getPageCount() {
		if (elementCount > 0) {
			pageCount = elementCount / pageSize;
			int remainder = elementCount % pageSize;
			if (remainder > 0) {
				pageCount++;
			}
		}
		return pageCount;
	}

	/**
	 * 获取总记录数
	 * 
	 * @param count
	 *            总记录数
	 */
	public int getElementCount() {
		return elementCount;
	}

	/**
	 * 设置总记录数
	 * 
	 * @param count
	 *            总记录数
	 */
	public void setElementCount(int elementCount) {
		this.elementCount = elementCount;
	}
	
	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}
	
	@Column(name="create_time")
	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	@Column(name="create_user")
	public String getCreateUser() {
		return createUser;
	}

	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}

	@Column(name="update_time")
	public String getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(String updateTime) {
		this.updateTime = updateTime;
	}

	@Column(name="update_user")
	public String getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}
}
